<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- > 目标: 点击按钮 - 把文字取反显示 - 再点击取反显示(回来了)
> 提示: 把字符串取反赋予回去 -->
    <div class="box">
        <h1>{{text}}</h1>
        <button @click="reverse" class="btn">bui~翻转</button>
    </div>

    <!-- 引入的是开发版本包 - 包含完整的注释和警告 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.14/vue.js"></script>
    <script>
        const btn = new Vue({
            el: '.box',
            data: {
                text: '123456'
            },
            methods: {
                reverse() {
                    this.text = this.text.split('').reverse().join('')
                }
            }
        })
    </script>
</body>

</html>